repo.or.cz
/
andmenj-acm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Adding some problems from Colombian National Contest 2010
[andmenj-acm.git]
/
11843 - Guessing Game
/
11843.cpp
blob
8759934aa94e6fc5426040d38b984a6beb8d836b
1
using namespace
std
;
2
#include <algorithm>
3
#include <iostream>
4
#include <iterator>
5
#include <numeric>
6
#include <sstream>
7
#include <fstream>
8
#include <cassert>
9
#include <climits>
10
#include <cstdlib>
11
#include <cstring>
12
#include <string>
13
#include <cstdio>
14
#include <vector>
15
#include <cmath>
16
#include <queue>
17
#include <deque>
18
#include <stack>
19
#include <list>
20
#include <map>
21
#include <set>
22
23
#define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
24
#define For(i, a, b) for (int i=(a); i<(b); ++i)
25
#define D(x) cout << #x
" is "
<< x << endl
26
27
int
main
(){
28
int
C
;
29
cin
>>
C
;
30
while
(
C
--) {
31
int
n
,
s
;
32
cin
>>
n
>>
s
;
33
int
ans
=
0
;
34
while
(
n
>
0
) {
35
if
(
s
>
1
) {
36
n
/=
2
;
37
s
--;
38
}
else
{
39
n
--;
40
}
41
ans
++;
42
}
43
printf
(
"%d
\n
"
,
ans
);
44
}
45
return
0
;
46
}